package com.sdhs.paas.gateway.model;

import java.beans.ConstructorProperties;
import org.springframework.http.HttpMethod;

public class AmeAccessPolicy
{
  String requestPath;
  HttpMethod requestMethod;
  String resource;
  String action;

  public AmeAccessPolicy(String requestPath, String requestMethod)
  {
    setRequestPath(requestPath);
    setRequestMethod(HttpMethod.resolve(requestMethod));
  }

  public String toString()
  {
    return this.requestPath + "?" + this.requestMethod;
  }

  public void setRequestPath(String requestPath)
  {
    this.requestPath = requestPath; } 
  public void setRequestMethod(HttpMethod requestMethod) { this.requestMethod = requestMethod; } 
  public void setResource(String resource) { this.resource = resource; } 
  public void setAction(String action) { this.action = action; }


  public String getRequestPath()
  {
    return this.requestPath;
  }

  public HttpMethod getRequestMethod()
  {
    return this.requestMethod;
  }

  public String getResource()
  {
    return this.resource;
  }

  public String getAction()
  {
    return this.action;
  }

  @ConstructorProperties({"requestPath", "requestMethod", "resource", "action"})
  public AmeAccessPolicy(String requestPath, HttpMethod requestMethod, String resource, String action)
  {
    this.requestPath = requestPath; this.requestMethod = requestMethod; this.resource = resource; this.action = action;
  }
}
